package org.idea.spring.condition.expressioninject;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @Author linhao
 * @Date created in 2:48 下午 2021/5/8
 */
public class ExpressApplication {

    @Autowired(required = false)
    private ExpressFalseBean expressFalseBean;

    @Autowired(required = false)
    private ExpressTrueBean expressTrueBean;

    public static void main(String[] args) {
        AnnotationConfigApplicationContext annotationConfigApplicationContext = new AnnotationConfigApplicationContext();
        annotationConfigApplicationContext.register(ExpressApplication.class);
        annotationConfigApplicationContext.register(ExpressAutoConfig.class);
        annotationConfigApplicationContext.refresh();

        ExpressApplication application = annotationConfigApplicationContext.getBean(ExpressApplication.class);
        System.out.println(application.expressFalseBean);
        System.out.println(application.expressTrueBean);

        annotationConfigApplicationContext.close();
    }
}
